module namespace resultview = "http://www.xmlproject.com/smi/lib/view/resultview";

(:~
 : Renders two searchresult xml fragments into one html table with two columns. 
 :
 : @param $searchresult1 the first searchresult will be shown in the left column  
 : @param $searchresult2 the second searchresult will be shown in the right column  
 : @return returns an HTML table containing the two rendered searchresults
 :)
declare function resultview:show($searchresult as element(searchresult))
{
<table>{
    for $result in $searchresult/result
        let $title := data($result/@title)
        let $href := data($result/@href)
        (: get rid of all line feeds and carriage returns :)
        let $content := normalize-space($result/text()) 
    return
        
            <tr style="vertical-align: top;">
                <td style="width:50%">
                <h3><a href="{$href}">{$title}</a></h3>
                </td>
            </tr>}
</table>
};
declare function resultview:show2($searchresult as element(searchresult))
{fn:trace($searchresult, 'The value of $searchresult is: ')
};